#include <iostream>
using namespace std;

class Integeter {
    friend ostream& operator << (ostream& out ,const Integeter& n);
public:
    Integeter() {
        m_num = 0;
    }

    //前置++ 递增运算符重载  ： 要使用引用& ， 通过引用的方式可以返回m_num经历++后的值
    Integeter& operator++() {
        //先++
        m_num++;
        //后返回
        return *this;
    }

    //后置++
    Integeter operator++(int) {
        //先用一个来接受原本的值
        Integeter temp = *this;
        //在++
        m_num++;
        //最后返回
        return temp;
    }
private:
    int m_num;
};

ostream& operator << (ostream& out , const Integeter& n) {
    out << n.m_num;
    return out;
}

void test01() {
    Integeter n;
    cout << ++n << endl;
    cout << n << endl;
}

void test02() {
    Integeter n;
    cout << n++ << endl;
    cout << n << endl;

}


int main() {
    test02();
    return 0;
}